home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / refer.bst < prev    next >
Text File  |  1992-07-19  |  4KB  |  167 lines

  1. %
  2. % 8/4/'90
  3. %Ciaran McHale
  4. %Department of Computer Science, Trinity College, Dublin 2, Ireland.
  5. %Telephone: +353-1-772941 ext 1538    FAX: +353-1-772204   Telex: 93782 TCD EI
  6. %email: cjmchale@cs.tcd.ie       or      cjmchale%cs.tcd.ie@cunyvm.cuny.edu
  7. % Hacked together by Ciaran McHale (cjmchale@cs.tcd.ie) to translate
  8. % BibTeX bibliographies into refer format
  9. % Based on a bib style file by Kannan Varadhan
  10. %
  11.  
  12.  
  13. ENTRY
  14.   {                                     % entry fields
  15.         abstract                % non standard
  16.     address
  17.         annote                  % non standard
  18.     author
  19.     booktitle
  20.     chapter
  21.     edition
  22.     editor
  23.     howpublished
  24.     institution
  25.     journal
  26.     key
  27.         keywords                % non standard
  28.     month
  29.     note
  30.     number
  31.     organization
  32.     pages
  33.     publisher
  34.     school
  35.     series
  36.     title
  37.     type
  38.     volume
  39.     year
  40.   }
  41.   {}                                    % no integer entry variables
  42.   { label extra.label sort.label }      % label entry variables
  43.  
  44.  
  45. STRINGS { s t a.name }
  46.  
  47.  
  48. FUNCTION {not}
  49. {   { #0 }
  50.     { #1 }
  51.   if$
  52. }
  53.  
  54. FUNCTION {and}
  55. {   'skip$
  56.     { pop$ #0 }
  57.   if$
  58. }
  59.  
  60. FUNCTION {or}
  61. {   { pop$ #1 }
  62.     'skip$
  63.   if$
  64. }
  65.  
  66. INTEGERS { nameptr namesleft numnames }
  67.  
  68. FUNCTION {handle.names}
  69. { 't :=         % type e.g. "A" for authors, "E" for editors
  70.   's :=         % the string containing the names
  71.   #1 'nameptr :=
  72.   s num.names$ 'numnames :=
  73.   numnames 'namesleft :=
  74.     { namesleft #0 > }
  75.  
  76.     { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 'a.name :=
  77.  
  78.       a.name "others" =
  79.         'skip$  % don't print out "%A others"
  80.         { "%" t * " " * a.name * write$ newline$ }
  81.       if$
  82.       nameptr #1 + 'nameptr :=
  83.       namesleft #1 - 'namesleft :=
  84.     }
  85.   while$
  86. }
  87.  
  88. FUNCTION {handle.maybe.empty}
  89. {
  90.   't :=
  91.   duplicate$
  92.   empty$
  93.     'pop$
  94.     { "%" t * " " * swap$ * write$ newline$ }
  95.   if$
  96. }
  97.  
  98. FUNCTION {translate}
  99. {
  100.   newline$      % get a blank line between each entry
  101.  
  102.   title "T" handle.maybe.empty
  103.   booktitle "B" handle.maybe.empty
  104.  
  105.   % there may be multiple authors so handle it differently
  106.   author empty$
  107.     { " empty author in " cite$ * warning$ }
  108.     { author "A" handle.names }
  109.   if$
  110.   editor "E" handle.maybe.empty
  111.   journal "J" handle.maybe.empty
  112.   keywords "K" handle.maybe.empty
  113.   cite$ "L" handle.maybe.empty
  114.   volume "V" handle.maybe.empty
  115.   abstract "X" handle.maybe.empty
  116.  
  117.   % The date, if present may be just the year or both the month and year
  118.   % or might even be just the month
  119.   month empty$ year empty$ and
  120.     'skip$      % no date of publication so nothing to do
  121.     {
  122.       month empty$      % I'm using the if statement because I'm not
  123.         { "" }          % sure that--- month " " year * --- would work.
  124.         { month " " * } % (The manual doesn't mention anything about
  125.       if$               % this so I'm playing safe)
  126.       year empty$
  127.         { "" }
  128.         { year }
  129.       if$
  130.       *
  131.       "D" handle.maybe.empty
  132.     }
  133.   if$
  134.   pages "P" handle.maybe.empty
  135.   note "O" handle.maybe.empty
  136.   number "N" handle.maybe.empty
  137.   series "S" handle.maybe.empty
  138.   annote "Y" handle.maybe.empty
  139.   address "C" handle.maybe.empty
  140.  
  141. }
  142.  
  143.  
  144. FUNCTION {article} { translate }
  145. FUNCTION {book} { translate }
  146. FUNCTION {booklet} { translate }
  147. FUNCTION {inbook} { translate }
  148. FUNCTION {incollection} { translate }
  149. FUNCTION {inproceedings} { translate }
  150. FUNCTION {manual} { translate }
  151. FUNCTION {mastersthesis} { translate }
  152. FUNCTION {misc} { translate }
  153. FUNCTION {phdthesis} { translate }
  154. FUNCTION {proceedings} { translate }
  155. FUNCTION {techreport} { translate }
  156. FUNCTION {unpublished} { translate }
  157. FUNCTION {default.type} { translate }
  158.  
  159.  
  160. READ
  161.  
  162. ITERATE {call.type$}
  163.  
  164.  
  165.  
  166.  
  167.